<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QCursor Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QCursor Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QCursor class provides a mouse cursor with an arbitrary
shape. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qcursor.html#QCursor">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcursor.html#QCursor-2">__init__</a></b> (<i>self</i>, Qt.CursorShape&#160;<i>shape</i>)</li><li><div class="fn" /><b><a href="qcursor.html#QCursor-3">__init__</a></b> (<i>self</i>, QBitmap&#160;<i>bitmap</i>, QBitmap&#160;<i>mask</i>, int&#160;<i>hotX</i>&#160;=&#160;-1, int&#160;<i>hotY</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qcursor.html#QCursor-4">__init__</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>, int&#160;<i>hotX</i>&#160;=&#160;-1, int&#160;<i>hotY</i>&#160;=&#160;-1)</li><li><div class="fn" /><b><a href="qcursor.html#QCursor-5">__init__</a></b> (<i>self</i>, QCursor&#160;<i>cursor</i>)</li><li><div class="fn" /><b><a href="qcursor.html#QCursor-6">__init__</a></b> (<i>self</i>, QVariant&#160;<i>variant</i>)</li><li><div class="fn" />QBitmap <b><a href="qcursor.html#bitmap">bitmap</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qcursor.html#hotSpot">hotSpot</a></b> (<i>self</i>)</li><li><div class="fn" />QBitmap <b><a href="qcursor.html#mask">mask</a></b> (<i>self</i>)</li><li><div class="fn" />QPixmap <b><a href="qcursor.html#pixmap">pixmap</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qcursor.html#setShape">setShape</a></b> (<i>self</i>, Qt.CursorShape&#160;<i>newShape</i>)</li><li><div class="fn" />Qt.CursorShape <b><a href="qcursor.html#shape">shape</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QPoint <b><a href="qcursor.html#pos">pos</a></b> ()</li><li><div class="fn" /><b><a href="qcursor.html#setPos">setPos</a></b> (int&#160;<i>x</i>, int&#160;<i>y</i>)</li><li><div class="fn" /><b><a href="qcursor.html#setPos-2">setPos</a></b> (QPoint&#160;<i>p</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>A
    <a href="qt.html#CursorShape-enum">Qt.CursorShape</a>
    may be used whenever a
    <a href="qcursor.html">QCursor</a>
    is expected.</p>
  <p>The QCursor class provides a mouse cursor with an arbitrary
shape.</p>
<p>This class is mainly used to create mouse cursors that are
associated with particular widgets and to get and set the position
of the mouse cursor.</p>
<p>Qt has a number of standard cursor shapes, but you can also make
custom cursor shapes based on a <a href="qbitmap.html">QBitmap</a>,
a mask and a hotspot.</p>
<p>To associate a cursor with a widget, use <a href="qwidget.html#cursor-prop">QWidget.setCursor</a>(). To associate a
cursor with all widgets (normally for a short period of time), use
<a href="qapplication.html#setOverrideCursor">QApplication.setOverrideCursor</a>().</p>
<p>To set a cursor shape use <a href="qcursor.html#setShape">QCursor.setShape</a>() or use the QCursor
constructor which takes the shape as argument, or you can use one
of the predefined cursors defined in the <a href="qt.html#CursorShape-enum">Qt.CursorShape</a> enum.</p>
<p>If you want to create a cursor with your own bitmap, either use
the QCursor constructor which takes a bitmap and a mask or the
constructor which takes a pixmap as arguments.</p>
<p>To set or get the position of the mouse cursor use the static
methods <a href="qcursor.html#pos">QCursor.pos</a>() and <a href="qcursor.html#setPos">QCursor.setPos</a>().</p>
<p><b>Note:</b> It is possible to create a QCursor before <a href="qapplication.html">QApplication</a>, but it is not useful except
as a place-holder for a real QCursor created after <a href="qapplication.html">QApplication</a>. Attempting to use a QCursor
that was created before <a href="qapplication.html">QApplication</a> will result in a crash.</p>
<a id="a-note-for-x11-users" name="a-note-for-x11-users" />
<h3>A Note for X11 Users</h3>
<p>On X11, Qt supports the <a href="http://www.xfree86.org/4.3.0/Xcursor.3.html">Xcursor</a> library,
which allows for full color icon themes. The table below shows the
cursor name used for each <a href="qt.html#CursorShape-enum">Qt.CursorShape</a> value. If a cursor
cannot be found using the name shown below, a standard X11 cursor
will be used instead. Note: X11 does not provide appropriate
cursors for all possible <a href="qt.html#CursorShape-enum">Qt.CursorShape</a> values. It is
possible that some cursors will be taken from the Xcursor theme,
while others will use an internal bitmap cursor.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Shape</th>
<th><a href="qt.html#CursorShape-enum">Qt.CursorShape</a>
Value</th>
<th>Cursor Name</th>
<th>Shape</th>
<th><a href="qt.html#CursorShape-enum">Qt.CursorShape</a>
Value</th>
<th>Cursor Name</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img alt="" src="images/cursor-arrow.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.ArrowCursor</a></td>
<td><tt>left_ptr</tt></td>
<td><img alt="" src="images/cursor-sizev.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SizeVerCursor</a></td>
<td><tt>size_ver</tt></td>
</tr>
<tr class="even" valign="top">
<td><img alt="" src="images/cursor-uparrow.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.UpArrowCursor</a></td>
<td><tt>up_arrow</tt></td>
<td><img alt="" src="images/cursor-sizeh.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SizeHorCursor</a></td>
<td><tt>size_hor</tt></td>
</tr>
<tr class="odd" valign="top">
<td><img alt="" src="images/cursor-cross.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.CrossCursor</a></td>
<td><tt>cross</tt></td>
<td><img alt="" src="images/cursor-sizeb.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SizeBDiagCursor</a></td>
<td><tt>size_bdiag</tt></td>
</tr>
<tr class="even" valign="top">
<td><img alt="" src="images/cursor-ibeam.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.IBeamCursor</a></td>
<td><tt>ibeam</tt></td>
<td><img alt="" src="images/cursor-sizef.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SizeFDiagCursor</a></td>
<td><tt>size_fdiag</tt></td>
</tr>
<tr class="odd" valign="top">
<td><img alt="" src="images/cursor-wait.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.WaitCursor</a></td>
<td><tt>wait</tt></td>
<td><img alt="" src="images/cursor-sizeall.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SizeAllCursor</a></td>
<td><tt>size_all</tt></td>
</tr>
<tr class="even" valign="top">
<td><img alt="" src="images/cursor-busy.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.BusyCursor</a></td>
<td><tt>left_ptr_watch</tt></td>
<td><img alt="" src="images/cursor-vsplit.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SplitVCursor</a></td>
<td><tt>split_v</tt></td>
</tr>
<tr class="odd" valign="top">
<td><img alt="" src="images/cursor-forbidden.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.ForbiddenCursor</a></td>
<td><tt>forbidden</tt></td>
<td><img alt="" src="images/cursor-hsplit.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.SplitHCursor</a></td>
<td><tt>split_h</tt></td>
</tr>
<tr class="even" valign="top">
<td><img alt="" src="images/cursor-hand.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.PointingHandCursor</a></td>
<td><tt>pointing_hand</tt></td>
<td><img alt="" src="images/cursor-openhand.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.OpenHandCursor</a></td>
<td><tt>openhand</tt></td>
</tr>
<tr class="odd" valign="top">
<td><img alt="" src="images/cursor-whatsthis.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.WhatsThisCursor</a></td>
<td><tt>whats_this</tt></td>
<td><img alt="" src="images/cursor-closedhand.png" /></td>
<td><a href="qt.html#CursorShape-enum">Qt.ClosedHandCursor</a></td>
<td><tt>closedhand</tt></td>
</tr>
<tr class="even" valign="top">
<td />
<td><a href="qt.html#CursorShape-enum">Qt.DragMoveCursor</a></td>
<td><tt>dnd-move</tt> or <tt>move</tt></td>
<td />
<td><a href="qt.html#CursorShape-enum">Qt.DragCopyCursor</a></td>
<td><tt>dnd-copy</tt> or <tt>copy</tt></td>
</tr>
<tr class="odd" valign="top">
<td />
<td><a href="qt.html#CursorShape-enum">Qt.DragLinkCursor</a></td>
<td><tt>dnd-link</tt> or <tt>link</tt></td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QCursor" />QCursor.__init__ (<i>self</i>)</h3><p>Constructs a cursor with the default arrow shape.</p>


<h3 class="fn"><a name="QCursor-2" />QCursor.__init__ (<i>self</i>, <a href="qt.html#CursorShape-enum">Qt.CursorShape</a>&#160;<i>shape</i>)</h3><p>Constructs a cursor with the specified <i>shape</i>.</p>
<p>See <a href="qt.html#CursorShape-enum">Qt.CursorShape</a> for a
list of shapes.</p>
<p><b>See also</b> <a href="qcursor.html#setShape">setShape</a>().</p>


<h3 class="fn"><a name="QCursor-3" />QCursor.__init__ (<i>self</i>, <a href="qbitmap.html">QBitmap</a>&#160;<i>bitmap</i>, <a href="qbitmap.html">QBitmap</a>&#160;<i>mask</i>, int&#160;<i>hotX</i>&#160;=&#160;-1, int&#160;<i>hotY</i>&#160;=&#160;-1)</h3><p>Constructs a custom bitmap cursor.</p>
<p><i>bitmap</i> and <i>mask</i> make up the bitmap. <i>hotX</i>
and <i>hotY</i> define the cursor's hot spot.</p>
<p>If <i>hotX</i> is negative, it is set to the
<tt>bitmap().width()/2</tt>. If <i>hotY</i> is negative, it is set
to the <tt>bitmap().height()/2</tt>.</p>
<p>The cursor <i>bitmap</i> (B) and <i>mask</i> (M) bits are
combined like this:</p>
<ul>
<li>B=1 and M=1 gives black.</li>
<li>B=0 and M=1 gives white.</li>
<li>B=0 and M=0 gives transparent.</li>
<li>B=1 and M=0 gives an XOR'd result under Windows, undefined
results on all other platforms.</li>
</ul>
<p>Use the global Qt color <a href="qt.html#GlobalColor-enum">Qt.color0</a> to draw 0-pixels and
<a href="qt.html#GlobalColor-enum">Qt.color1</a> to draw 1-pixels
in the bitmaps.</p>
<p>Valid cursor sizes depend on the display hardware (or the
underlying window system). We recommend using 32 x 32 cursors,
because this size is supported on all platforms. Some platforms
also support 16 x 16, 48 x 48, and 64 x 64 cursors.</p>
<p><b>Note:</b> On Windows CE, the cursor size is fixed. If the
pixmap is bigger than the system size, it will be scaled.</p>
<p><b>See also</b> <a href="qbitmap.html#QBitmap">QBitmap.QBitmap</a>() and <a href="qpixmap.html#setMask">QBitmap.setMask</a>().</p>


<h3 class="fn"><a name="QCursor-4" />QCursor.__init__ (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, int&#160;<i>hotX</i>&#160;=&#160;-1, int&#160;<i>hotY</i>&#160;=&#160;-1)</h3><p>Constructs a custom pixmap cursor.</p>
<p><i>pixmap</i> is the image. It is usual to give it a mask (set
using <a href="qpixmap.html#setMask">QPixmap.setMask</a>()).
<i>hotX</i> and <i>hotY</i> define the cursor's hot spot.</p>
<p>If <i>hotX</i> is negative, it is set to the
<tt>pixmap().width()/2</tt>. If <i>hotY</i> is negative, it is set
to the <tt>pixmap().height()/2</tt>.</p>
<p>Valid cursor sizes depend on the display hardware (or the
underlying window system). We recommend using 32 x 32 cursors,
because this size is supported on all platforms. Some platforms
also support 16 x 16, 48 x 48, and 64 x 64 cursors.</p>
<p><b>Note:</b> On Windows CE, the cursor size is fixed. If the
pixmap is bigger than the system size, it will be scaled.</p>
<p><b>See also</b> <a href="qpixmap.html#QPixmap">QPixmap.QPixmap</a>() and <a href="qpixmap.html#setMask">QPixmap.setMask</a>().</p>


<h3 class="fn"><a name="QCursor-5" />QCursor.__init__ (<i>self</i>, <a href="qcursor.html">QCursor</a>&#160;<i>cursor</i>)</h3><p>Constructs a copy of the cursor <i>c</i>.</p>


<h3 class="fn"><a name="QCursor-6" />QCursor.__init__ (<i>self</i>, QVariant&#160;<i>variant</i>)</h3><p>Constructs a Qt cursor from the given Windows <i>cursor</i>.</p>
<p><b>Warning:</b> This function is only available on Windows.</p>
<p><b>See also</b> <a href="qcursor.html#handle">handle</a>().</p>


<h3 class="fn"><a name="bitmap" /><a href="qbitmap.html">QBitmap</a> QCursor.bitmap (<i>self</i>)</h3><p>Returns the cursor bitmap, or 0 if it is one of the standard
cursors.</p>


<h3 class="fn"><a name="hotSpot" /><a href="qpoint.html">QPoint</a> QCursor.hotSpot (<i>self</i>)</h3><h3 class="fn"><a name="mask" /><a href="qbitmap.html">QBitmap</a> QCursor.mask (<i>self</i>)</h3><p>Returns the cursor bitmap mask, or 0 if it is one of the
standard cursors.</p>


<h3 class="fn"><a name="pixmap" /><a href="qpixmap.html">QPixmap</a> QCursor.pixmap (<i>self</i>)</h3><p>Returns the cursor pixmap. This is only valid if the cursor is a
pixmap cursor.</p>


<h3 class="fn"><a name="pos" /><a href="qpoint.html">QPoint</a> QCursor.pos ()</h3><p>Returns the position of the cursor (hot spot) in global screen
coordinates.</p>
<p>You can call <a href="qwidget.html#mapFromGlobal">QWidget.mapFromGlobal</a>() to
translate it to widget coordinates.</p>
<p><b>See also</b> <a href="qcursor.html#setPos">setPos</a>(),
<a href="qwidget.html#mapFromGlobal">QWidget.mapFromGlobal</a>(),
and <a href="qwidget.html#mapToGlobal">QWidget.mapToGlobal</a>().</p>


<h3 class="fn"><a name="setPos" />QCursor.setPos (int&#160;<i>x</i>, int&#160;<i>y</i>)</h3><p>Moves the cursor (hot spot) to the global screen position
(<i>x</i>, <i>y</i>).</p>
<p>You can call <a href="qwidget.html#mapToGlobal">QWidget.mapToGlobal</a>() to translate
widget coordinates to global screen coordinates.</p>
<p><b>See also</b> <a href="qcursor.html#pos">pos</a>(), <a href="qwidget.html#mapFromGlobal">QWidget.mapFromGlobal</a>(), and
<a href="qwidget.html#mapToGlobal">QWidget.mapToGlobal</a>().</p>


<h3 class="fn"><a name="setPos-2" />QCursor.setPos (<a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Moves the cursor (hot spot) to the global screen position at
point <i>p</i>.</p>


<h3 class="fn"><a name="setShape" />QCursor.setShape (<i>self</i>, <a href="qt.html#CursorShape-enum">Qt.CursorShape</a>&#160;<i>newShape</i>)</h3><p>Sets the cursor to the shape identified by <i>shape</i>.</p>
<p>See <a href="qt.html#CursorShape-enum">Qt.CursorShape</a> for
the list of cursor shapes.</p>
<p><b>See also</b> <a href="qcursor.html#shape">shape</a>().</p>


<h3 class="fn"><a name="shape" /><a href="qt.html#CursorShape-enum">Qt.CursorShape</a> QCursor.shape (<i>self</i>)</h3><p>Returns the cursor shape identifier. The return value is one of
the <a href="qt.html#CursorShape-enum">Qt.CursorShape</a> enum
values (cast to an int).</p>
<p><b>See also</b> <a href="qcursor.html#setShape">setShape</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>